package com.okhttp;


import android.text.TextUtils;
import android.util.Log;

import com.baselibrary.utils.CommonUtil;
import com.baselibrary.utils.SpUtils;
import com.okhttp.callbacks.Callback;
import com.okhttp.utils.APIUrls;
import com.okhttp.utils.OkHttpUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;


public class SendRequest {
    private static String TAG = "SendRequest";

    /**
     * NFC 溯源请求认证
     */
    public static void getRandom4ZhongQi(RequestBody body, String url, okhttp3.Callback responseCallback) {
        OkHttpClient okHttpClient = OkHttpUtils.getInstance().getOkHttpClient();
        Request.Builder mRequestBuilder = new Request.Builder().url(url);
        Request mRequest = mRequestBuilder.post(body)
                .build();
        okHttpClient.newCall(mRequest).enqueue(responseCallback);
    }

    /**
     * NFC 溯源解密
     */
    public static void decodeCiperText(RequestBody body, String url, okhttp3.Callback responseCallback) {
        OkHttpClient okHttpClient = OkHttpUtils.getInstance().getOkHttpClient();
        Request.Builder mRequestBuilder = new Request.Builder().url(url);
        Request mRequest = mRequestBuilder.post(body)
                .build();
        okHttpClient.newCall(mRequest).enqueue(responseCallback);
    }

    /**
     * 搜索话题
     */
    public static void releaseSearchTopics(String token, String searchKey, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("searchKey", searchKey); //
        map.put("type", "0"); //type 0选择话题 1全部话题
        OkHttpUtils.get().params(map).url(APIUrls.release_SearchFriends).build().execute(call);

    }


    /**
     * 发布动态
     *
     * @param showType 0-普通 1-文章 2-视频 3-音频 4-转发
     */
    public static void sendDynamic(String districtId, int uid, ArrayList<String> images, String address, String token, String cover,
                                   int showType, String provinceId, String cityId, String content, String video, String tagstr, String atMemberIdStr, String wineryId, String wineryCode, Callback call) {
        Map<String, String> map = new HashMap<>();
        if (!TextUtils.isEmpty(districtId)) {
            map.put("districtId", districtId);
        }

        map.put("uid", String.valueOf(uid));
        map.put("showType", String.valueOf(showType));

        if (!TextUtils.isEmpty(address)) {
            map.put("address", address);
        }

        if (!TextUtils.isEmpty(token)) {
            map.put("token", token);
        }

        if (!TextUtils.isEmpty(cover)) {
            map.put("cover", cover);
        }

        if (!TextUtils.isEmpty(provinceId)) {
            map.put("provinceId", provinceId);
        }

        if (!TextUtils.isEmpty(cityId)) {
            map.put("cityId", cityId);
        }

        if (!TextUtils.isEmpty(content)) {
            map.put("content", content);
        }
        if (!TextUtils.isEmpty(video)) {
            map.put("video", video);
        }
        if (!TextUtils.isEmpty(tagstr)) {
            map.put("tagstr", tagstr);
        }
        if (!TextUtils.isEmpty(atMemberIdStr)) {
            map.put("atMemberIdStr", atMemberIdStr);
        }
        if (!TextUtils.isEmpty(wineryId)) {
            map.put("wineryId", wineryId);
        }
        if (!TextUtils.isEmpty(wineryCode)) {
            map.put("wineryCode", wineryCode);
        }
        if (!CommonUtil.isBlank(images) && images.size() > 0 && CommonUtil.isBlank(video)) {
            for (int i = 0; i < images.size(); i++) {
                map.put("images[" + i + "]", images.get(i));
            }
        }

        map.put("phoneTime", String.valueOf(System.currentTimeMillis()));

        OkHttpUtils.post().params(map).url(APIUrls.timelineAdd).build().execute(call);

    }

    public static void checkName(String token, String name, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("name", name);
        OkHttpUtils.post().params(map).url(APIUrls.url_checkName).build().execute(call);

    }

    /**
     * 忘记密码 时获取验证码
     */
    public static void createForgotAuthCode(String phone, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("phone", phone);
        OkHttpUtils.post().params(map).url(APIUrls.url_createForgotAuthCode).build().execute(call);

    }

    /**
     * 修改密码
     */
    public static void updatePasswordAndLogin(String phone, String code, String password, String againPassword, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("phone", phone);
        map.put("code", code);
        map.put("password", password);
        map.put("againPassword", againPassword);
        OkHttpUtils.post().params(map).url(APIUrls.url_updatePasswordAndLogin).build().execute(call);

    }

    /**
     * 完善信息
     */
    public static void updateUser(String token, int id, String password, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("id", String.valueOf(id));
        map.put("password", password);
        OkHttpUtils.post().params(map).url(APIUrls.url_updateUser).build().execute(call);

    }

    /**
     * 第三方登录 微信登录
     */
    public static void loginForAuth(String openId, String avatar, String name, int type, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("key", openId);
        map.put("type", String.valueOf(type));
        map.put("wxPhoto", avatar);
        map.put("wxName", name);
        OkHttpUtils.post().params(map).url(APIUrls.loginForAuth).build().execute(call);
    }

    /**
     *
     */
    public static void bangPhoneCode(String phone, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("phone", phone);
        OkHttpUtils.post().params(map).url(APIUrls.bangPhoneCode).build().execute(call);

    }

    /**
     * @param call
     */
    public static void createMyPhoneCode(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.createMyPhoneCode).build().execute(call);

    }

    public static void getVisitor(Callback call) {
        Map<String, String> map = new HashMap<>();
        OkHttpUtils.post().params(map).url(APIUrls.getVisitor).build().execute(call);

    }

    /**
     * 发送更新手机号验证码
     *
     * @param phone
     * @param call
     */
    public static void createUpdatePhone(String token, String phone, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("phone", phone);
        OkHttpUtils.post().params(map).url(APIUrls.createUpdatePhone).build().execute(call);

    }

    /**
     * 更新手机号接口
     *
     * @param token
     * @param phone
     * @param call
     */
    public static void updatePhoneByPhone(String token, String phone, String code, String oldPhoneCode, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("phone", phone);
        map.put("code", code);
        map.put("oldPhoneCode", oldPhoneCode);
        OkHttpUtils.post().params(map).url(APIUrls.updatePhoneByPhone).build().execute(call);

    }

    /**
     * 绑定手机号
     */
    public static void bangPhoneByKey(String phone, String code, String avatar, String name, String password, String key, int type, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("phone", phone);
        map.put("code", code);
        map.put("password", password);
        map.put("wxPhoto", avatar);
        map.put("wxName", name);
        map.put("key", key);
        map.put("type", String.valueOf(type));
        map.put("phoneModel", android.os.Build.MODEL);
        if (SpUtils.getInstance().getChanneId() != 0) {
            map.put("channelId", SpUtils.getInstance().getChanneId() + "");
        }
        OkHttpUtils.post().params(map).url(APIUrls.bangPhoneByKey).build().execute(call);

    }

    public static void bindingAuthkey(String token, String key, String avatar, String name, int type, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("key", key);
        map.put("wxPhoto", avatar);
        map.put("wxName", name);
        map.put("type", String.valueOf(type));
        OkHttpUtils.post().params(map).url(APIUrls.bindingAuthkey).build().execute(call);

    }


    public static void unBindingAuthkey(String token, int type, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("type", String.valueOf(type));
        OkHttpUtils.post().params(map).url(APIUrls.unBindingAuthkey).build().execute(call);

    }

    public static void liveRoomLoad(String uid, String id, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("token", SpUtils.getInstance().getLoadUserBean().getData().getToken());
        map.put("id", id);
        OkHttpUtils.post().params(map).url(APIUrls.url_liveRoomLoad).build().execute(call);
    }

    public static void userLiveRoomPool(String token, int lid, String url, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("lid", String.valueOf(lid));
        OkHttpUtils.post().params(map).url(url).build().execute(call);
    }

    /**
     * 讲坛详情
     */
    public static void forumLoadClient(String token, int id, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("id", String.valueOf(id));
        OkHttpUtils.post().tag(APIUrls.forumLoadClient).params(map).url(APIUrls.forumLoadClient).build().execute(call);
    }

    /**
     * 兑换讲坛
     */
    public static void payCourse(String token, int fid, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("fid", String.valueOf(fid));
        OkHttpUtils.post().params(map).url(APIUrls.payCourse).build().execute(call);
    }

    /**
     * @param type 业务类型 1用户 2话题 3专栏 4讲坛
     */
    public static void focusFansAddAll(String token, int type, List<Integer> uids, Callback call) {
        Log.i(TAG, "focusFansAddAll: " + uids.size());
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("type", String.valueOf(type));
        if (uids.size() > 0) {
            for (int i = 0; i < 2; i++) {
                map.put("uids[]", String.valueOf(uids.get(0)));
            }
        }
        OkHttpUtils.post().params(map).url(APIUrls.focusFansAddAll).build().execute(call);

    }

    public static void getRecommendUserList(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.getRecommendUserList).build().execute(call);
    }


    /**
     * @param type 点赞类型 1评论的点赞 2文章点赞 3点评点赞 4timeline 6课程 7直播间
     */
    public static void supportAdd(String token, int type, int typeId, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("type", String.valueOf(type));
        map.put("typeId", String.valueOf(typeId));
        OkHttpUtils.post().params(map).url(APIUrls.web_support_add).build().execute(call);
    }


    public static void getLogPager(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.getLogPager).build().execute(call);
    }

    public static void checkSignIn(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.checkSignIn).build().execute(call);
    }

    public static void signIn(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.signIn).build().execute(call);
    }


    //    EVENT_A(1,"评论获取","/web/comment/add"),
    //    EVENT_B(2,"分享获取","/xxx"),
    //    EVENT_C(3,"签到获取","/xxx"),
    //    EVENT_D(4,"发布动态获取","/xxx"),
    //    EVENT_E(5,"下单获取","/xxx"),
    //    EVENT_F(6,"报名约局","/xxx"),
    //    EVENT_G(7,"创建约局","/xxx"),
    //    EVENT_H(8,"扫商品溯源码","/xxx"),
    //    EVENT_I(9,"评价商品","/xxx"),
    //    EVENT_I(11,"健康数据同步","/xxx"),
    public static void shareSuccessHandle(String token, int type, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("type", String.valueOf(type));
        OkHttpUtils.post().params(map).url(APIUrls.shareSuccessHandle).build().execute(call);
    }

    public static void shareSuccessHandle(String token, int type, String ext, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("type", String.valueOf(type));
        map.put("ext", ext);
        OkHttpUtils.post().params(map).url(APIUrls.shareSuccessHandle).build().execute(call);
    }

    public static void getListByType(Callback call) {
        getListByType(null, call);

    }

    public static void getListByType(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
//        map.put("token", token);
        OkHttpUtils.getInstance().post().params(map).url(APIUrls.getListByType).build().execute(call);

    }

    public static void logout(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.logout).build().execute(call);

    }

    public static void getDesc(Callback call) {
        Map<String, String> map = new HashMap<>();
        OkHttpUtils.post().params(map).url(APIUrls.getDesc).build().execute(call);

    }


    public static void user_get_user_info(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.user_get_user_info).build().execute(call);

    }

    public static void user_update_user(String token, String id, String name, String icon, String sex, String age, String desc,
                                        int photoEditType, int nameEditType, String wxPhoto, String wxName, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("id", id);
        map.put("name", !CommonUtil.isBlank(name) ? name : "");
        map.put("icon", !CommonUtil.isBlank(icon) ? icon : "");
        map.put("sex", !CommonUtil.isBlank(sex) ? sex : "");
        map.put("ageStage", !CommonUtil.isBlank(age) ? age : "");
        map.put("desc", !CommonUtil.isBlank(desc) ? desc : "");
        map.put("dynamic", "-1");
        map.put("channel", "-1");
        map.put("forum", "-1");
        map.put("tag", "-1");
        map.put("photoEditType", photoEditType + "");
        map.put("nameEditType", nameEditType + "");
        map.put("wxPhoto", wxPhoto);
        map.put("wxName", wxName);
        OkHttpUtils.post().params(map).url(APIUrls.user_update_user).build().execute(call);
    }

    /**
     * web端_分页获取评论
     */
    public static void commentPager(String token, String type, String typeId, String cursor, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("type", String.valueOf(type));
        map.put("typeId", String.valueOf(typeId));
        map.put("size", "10");
        map.put("cursor", cursor);
        OkHttpUtils.post().params(map).url(APIUrls.comment_pager).build().execute(call);
    }

    /**
     * 评论类型 1评论的评论 4文章评论 5产品评论 6动态评论 7专栏评论 8话题评论 9话题动态评论 10 讲坛评论 11 课程评论 12 渠道中心-拜访评论
     */
    public static void commentAdd(String token, int uid, int type, int typeId, String content, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("uid", String.valueOf(uid));
        map.put("type", String.valueOf(type));
        map.put("typeId", String.valueOf(typeId));
        map.put("content", content);
        OkHttpUtils.post().params(map).url(APIUrls.comment_add_new).build().execute(call);
    }

    /**
     * 评论类型 1评论的评论 4文章评论 5产品评论 6动态评论 7专栏评论 8话题评论 9话题动态评论 10 讲坛评论 11 课程评论
     */
    public static void childCommentAdd(String token, int uid, int type, int typeId, String pid, String puid, String content, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("uid", String.valueOf(uid));
        map.put("type", String.valueOf(type));
        map.put("typeId", String.valueOf(typeId));
        map.put("content", content);
        if (!TextUtils.isEmpty(pid)) {
            map.put("pid", pid);
        }
        if (!TextUtils.isEmpty(puid)) {
            map.put("puid", puid);
        }
        OkHttpUtils.post().params(map).url(APIUrls.comment_add_new).build().execute(call);
    }

    /**
     * 评论类型 1评论的评论 4文章评论 5产品评论 6动态评论 7专栏评论 8话题评论 9话题动态评论 10 讲坛评论 11 课程评论
     */
    public static void commentAdd(String token, int type, int typeId, String content, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("type", String.valueOf(type));
        map.put("typeId", String.valueOf(typeId));
        map.put("content", content);
        OkHttpUtils.post().params(map).url(APIUrls.comment_add).build().execute(call);
    }

    public static void useraddress_getUserAddresses(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.useraddress_getUserAddresses).build().execute(call);
    }

    public static void useraddress_add(String token, String name, String phone, String areaFirst, String areaSecond, String areaThree, String address, String def, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("name", name);
        map.put("phone", phone);
        map.put("areaFirst", areaFirst);
        map.put("areaSecond", areaSecond);
        map.put("areaThree", areaThree);
        map.put("address", address);
        map.put("def", def);
        OkHttpUtils.post().params(map).url(APIUrls.useraddress_add).build().execute(call);
    }

    public static void useraddress_update(String token, String id, String name, String phone, String areaFirst, String areaSecond, String areaThree, String address, String def, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("id", id);
        map.put("name", name);
        map.put("phone", phone);
        map.put("areaFirst", areaFirst);
        map.put("areaSecond", areaSecond);
        map.put("areaThree", areaThree);
        map.put("address", address);
        map.put("def", def);
        OkHttpUtils.post().params(map).url(APIUrls.useraddress_update).build().execute(call);
    }

    public static void useraddress_del(String token, String id, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("id", id);
        OkHttpUtils.post().params(map).url(APIUrls.useraddress_del).build().execute(call);
    }

    public static void userLiveRoomPool_getBookedLiveRooms(String token, int status, String nextCursor, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("activity", String.valueOf(status));
        map.put("size", "10");
        map.put("cursor", nextCursor);
        OkHttpUtils.post().params(map).url(APIUrls.userLiveRoomPool_getBookedLiveRooms).build().execute(call);
    }

    public static void web_banner_getBannerList(String token, String bannerType, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("bannerType", bannerType);
        OkHttpUtils.post().params(map).url(APIUrls.web_banner_getBannerList).build().execute(call);
    }

    //我的订单数字统计
    public static void reqMyOrderNum(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.my_order_num).build().execute(call);
    }

    public static void web_integralMall_getPagerGoods(String token, String nextCursor, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("size", "10");
        map.put("cursor", nextCursor);
        OkHttpUtils.post().params(map).url(APIUrls.web_integralMall_getPagerGoods).build().execute(call);
    }

    public static void web_integralMall_load(String token, String id, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("id", id);
        OkHttpUtils.post().params(map).url(APIUrls.web_integralMall_load).build().execute(call);
    }

    public static void web_integralMall_payGoods(String token, String gid, String uaid, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("gid", gid);
        map.put("uaid", uaid);
        OkHttpUtils.post().params(map).url(APIUrls.web_integralMall_payGoods).build().execute(call);
    }

    public static void web_integralMall_getPagerOrder(String token, String type, String cursor, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("type", type);
        map.put("size", "10");
        map.put("cursor", cursor);
        OkHttpUtils.post().params(map).url(APIUrls.web_integralMall_getPagerOrder).build().execute(call);
    }
    //话题分类  type 0选择话题 1全部话题
    public static void tag_getList(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("type", "0");
        OkHttpUtils.post().params(map).url(APIUrls.tag_getList).build().execute(call);
    }

    public static void dictionary_getListByType(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.dictionary_getListByType).build().execute(call);
    }

    public static void getChatUserByUid(String token, String uid, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("uid", uid);
        OkHttpUtils.post().params(map).url(APIUrls.getChatUserByUid).build().execute(call);
    }

    /**
     * 和陌生人聊天数【记录】
     */
    public static void reqRecordStrangerChatNum(String token, String strangerUid, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("strangerUid", strangerUid);
        OkHttpUtils.post().params(map).url(APIUrls.url_active_record_stranger_chatnum).build().execute(call);
    }

    /**
     * 和陌生人聊天数【查询】
     */
    public static void reqStrangerChatNum(String token, String strangerUid, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("strangerUid", strangerUid);
        OkHttpUtils.post().params(map).url(APIUrls.url_active_stranger_chatnum).build().execute(call);
    }

    /**
     * 发布问卷
     *
     * @param gid 群ID
     */
    public static void sendQuestionnaire(String token, long ctime, String gid, long tid, int uid, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("ctime", String.valueOf(ctime));
        map.put("gid", gid);
        map.put("origin", String.valueOf(0));
        map.put("originName", "APP");
        map.put("tid", String.valueOf(tid));
        map.put("tname", "酱香之旅满意度调查模板");
        map.put("uid", String.valueOf(uid));
        OkHttpUtils.post().params(map).url(APIUrls.URL_SEND_QUESTIONNAIRE).build().execute(call);
    }

    /**
     * complaintType 1:低俗色情 2:垃圾广告 3:辱骂攻击 4:其他违法信息 5:抄袭 6:暴露他人隐私 7:其他   14好友
     * <p>
     * complaintUid
     * <p>
     * typeId 1:文章 2:评论 3:动态 8:问题 9:约局 10:圈子 11:回答    14好友
     */
    public static void complainAdd(String token, int complaintType, int complaintUid, int type, int typeId, String content, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("content", content);
        map.put("type", String.valueOf(type));
        map.put("typeId", String.valueOf(typeId));
        map.put("complaintUid", String.valueOf(complaintUid));
        map.put("complaintType", String.valueOf(complaintType));
        OkHttpUtils.post().params(map).url(APIUrls.complainAdd).build().execute(call);
    }

    public static void updateYouMengToken(String token, String youMengToken, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("youMengToken", youMengToken);
        map.put("plat", "android");
        OkHttpUtils.post().params(map).url(APIUrls.updateYouMengToken).build().execute(call);

    }

    public static void web_comment_del(String token, int id, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("id", String.valueOf(id));
        OkHttpUtils.post().params(map).url(APIUrls.web_comment_del).build().execute(call);
    }

    /**
     * 收藏
     *
     * @param token token
     * @param type  类型：1文章 2产品 3课程 4动态 5讲坛 6专栏 7约局
     * @param id    收藏内容的id
     * @param call  数据
     */
    public static void web_favorite_add(String token, String type, String id, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("type", type);
        map.put("typeId", id);
        OkHttpUtils.post().params(map).url(APIUrls.web_favorite_add).build().execute(call);
    }

    /**
     * 取消收藏
     *
     * @param token token
     * @param type  类型：1文章 2产品 3课程 4动态 5讲坛 6专栏 7约局
     * @param id    收藏内容的id
     * @param call  数据
     */
    public static void web_favorite_delete(String token, String type, String id, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("type", type);
        map.put("typeId", id);
        OkHttpUtils.post().params(map).url(APIUrls.web_favorite_delete).build().execute(call);
    }

    public static void web_support_add(String token, String type, String id, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("type", type);
        map.put("typeId", id);
        OkHttpUtils.post().params(map).url(APIUrls.web_support_add).build().execute(call);
    }

    public static void web_support_delete(String token, String type, String id, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("type", type);
        map.put("typeId", id);
        OkHttpUtils.post().params(map).url(APIUrls.web_support_delete).build().execute(call);
    }

    public static void focusFans_add(String token, String type, String id, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("type", type);
        map.put("thirdId", id);
        OkHttpUtils.post().params(map).url(APIUrls.focusFans_add).build().execute(call);
    }

    public static void focusFans_del(String token, String type, String id, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("type", type);
        map.put("thirdId", id);
        OkHttpUtils.post().params(map).url(APIUrls.focusFans_del).build().execute(call);
    }

    public static void timeline_userTimeline(String token, String uid, String nextCursor, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("cursor", nextCursor);
        map.put("size", String.valueOf(20));
        map.put("uid", uid);
        OkHttpUtils.post().params(map).url(APIUrls.timeline_userTimeline).build().execute(call);
    }

    public static void productorder_queryKuaiDi(String token, String poId, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("poId", poId);
        OkHttpUtils.post().params(map).url(APIUrls.productorder_queryKuaiDi_new).build().execute(call);
    }

    public static void tupu_checkImgs(String token, String imgUrls, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("imgUrls", imgUrls);
        OkHttpUtils.post().params(map).url(APIUrls.tupu_checkImgs).build().execute(call);
    }

    public static void tupu_checkTexts(String token, String texts, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("texts", texts);
        OkHttpUtils.post().params(map).url(APIUrls.tupu_checkTexts).build().execute(call);
    }

    /**
     * 下酒菜 获取文章详情
     */
    public static void getWenzhangDetailsList(String token, int aid, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("aid", String.valueOf(aid));
        OkHttpUtils.post().params(map).url(APIUrls.url_getWenzhangDetailsList).build().execute(call);

    }

    /**
     * 版本更新
     */
    public static void getVersion(String version, String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("versionNumber", version);
        map.put("token", token);
        map.put("type", "1");
        OkHttpUtils.get().params(map).url(APIUrls.url_getVersion).build().execute(call);
    }

    /**
     * 配置
     */
    public static void getHotPopup(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.url_getHotPopup).build().execute(call);
    }

    /**
     * 分享福袋信息
     */
    public static void getShareInfo(String uid, String id, String luckId, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("id", id);
        map.put("luckId", luckId);
        OkHttpUtils.post().params(map).url(APIUrls.url_share_lucky_bag).build().execute(call);
    }


    /**
     * 健康首页用户信息
     */
    public static void getHealthHome(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.URL_HEALTH_HOME).build().execute(call);
    }

    /**
     * 健康用户基本信息设置
     */
    public static void healthUserSetting(String token, String birthdate, String height, String weight, int sex, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("birthdate", birthdate);
        map.put("height", height);
        map.put("weight", weight);
        map.put("sex", sex + "");
        OkHttpUtils.post().params(map).url(APIUrls.URL_HEALTH_USER_SETTING).build().execute(call);
    }

    /**
     * 健康血氧新增
     */
    public static void healthBloodOxygenSync(String token, String json, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("bloodOxygen", json);
        OkHttpUtils.post().params(map).url(APIUrls.URL_HEALTH_BLOODOXYGEN_SYNC).build().execute(call);
    }

    /**
     * 健康血压新增
     */
    public static void healthBloodPressureSync(String token, String json, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("bloodPressure", json);
        OkHttpUtils.post().params(map).url(APIUrls.URL_HEALTH_BLOODPRESSURE_SYNC).build().execute(call);
    }

    /**
     * 健康心率新增
     */
    public static void healthHeartrateSync(String token, String json, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("heartrate", json);
        OkHttpUtils.post().params(map).url(APIUrls.URL_HEALTH_HEARTRATE_SYNC).build().execute(call);
    }

    /**
     * 健康睡眠新增
     */
    public static void healthSleepSync(String token, String json, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("sleep", json);
        OkHttpUtils.post().params(map).url(APIUrls.URL_HEALTH_SLEEP_SYNC).build().execute(call);
    }

    /**
     * 健康运动新增
     */
    public static void healthSportsSync(String token, String json, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("sports", json);
        OkHttpUtils.post().params(map).url(APIUrls.URL_HEALTH_SPORTS_SYNC).build().execute(call);
    }

    /**
     * 记录健康用户
     *
     * @param token
     * @param call
     */
    public static void healthUserRegistered(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.URL_HEALTH_USER_REGISTERED).build().execute(call);
    }

    /**
     * 步数排行榜
     *
     * @param token
     */
    public static void loadRankingList(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.URL_RANKING_LIST).build().execute(call);
    }

    /**
     * 【新版】获取个人中心菜单
     */
    public static void requestMineCenterMenu(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.URL_MINE_CENTER_MENU).build().execute(call);
    }


    /**
     * 审核轮次0 待审 1 一轮审核完成 2 二轮完成即审核完成 -1 拒绝(重新提交审核变为待审)
     */
    public static void requestFansApplyStatus(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.URL_FANS_APPLY_STATUS).build().execute(call);
    }

    /**
     * 【新版】获取自己或别人的个人中心数据
     */
    public static void requestUserInfoData(String token, String uid, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("uid", uid);
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.URL_USER_INFO_DATA).build().execute(call);
    }

    /**
     * 获取用户是否是经营者
     */
    public static void requestGetUserWienryStatus(String token, String phone, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("phone", phone);
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.URL_GET_USER_WINERY_STATUS).build().execute(call);
    }


    /**
     * 修改经营者状态 0未选择 1社区 2经营者
     */
    public static void reqChangeWineryManagerStatus(String token, String wineryStatus, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("wineryStatus", wineryStatus);
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.URL_CHANGE_WINERY_STATUS).build().execute(call);
    }

    /**
     * 开屏广告
     */
    public static void getConfigureAdvert(Callback call) {
        Map<String, String> map = new HashMap<>();
        OkHttpUtils.post().params(map).url(APIUrls.URL_ADVERT).build().execute(call);
    }

    /**
     * 新版  评论列表
     * <p>
     * type
     * <p>
     * type_comment = 1;  // 评论的评论
     * type_dianping = 2;  // 点评的评论
     * type_article = 4;  // 文章的评论
     * type_timeline = 6;//timeline动态
     * //    新加类型
     * type_columnComment = 7;       // 专栏评论
     * type_topicComment = 8;  // 话题评论
     * type_topicTimelineComment = 9;  // 话题动态评论
     * type_forumComment = 10;//讲坛评论
     * type_forum_course = 11;//课程评论
     * <p>
     * type_appetizer = 12;//下酒菜类型
     * type_qa = 13;//回答类型
     * type_product = 14;//商品评价类型
     * type_essay = 15;//趣百科类型
     *
     * @param pid = 一个评论的所有评论
     */
    public static void getNewComment(String token, int page, int type, int typeId, int pid, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("type", String.valueOf(type));
        map.put("typeId", String.valueOf(typeId));
        map.put("page", String.valueOf(page));
        map.put("size", "10");
        map.put("pid", String.valueOf(pid == 0 ? "" : pid));
        OkHttpUtils.post().params(map).url(APIUrls.URL_NEWCOMMENT).build().execute(call);
    }

    /**
     * NFC 溯源请求认证
     */
    public static void getRandom(RequestBody body, HashMap<String, String> headers, String url, okhttp3.Callback responseCallback) {


        OkHttpClient okHttpClient = OkHttpUtils.getInstance().getOkHttpClient();


        Request.Builder mRequestBuilder = new Request.Builder().url(url);

        for (String key : headers.keySet()) {
            String value = headers.get(key);
            mRequestBuilder.addHeader(key, value);
        }
        Request mRequest = mRequestBuilder.post(body)
                .build();
        okHttpClient.newCall(mRequest).enqueue(responseCallback);
    }

    /**
     * /**
     * 粉丝大礼包扫码
     *
     * @param type =0 仅扫码
     */
    public static void loadScanFansCode(String token, int type, String code, Callback call) {
        Map<String, String> map = new HashMap<>();
        if (type != 0) {
            map.put("token", token);
        }
        map.put("type", String.valueOf(type));
        map.put("code", code);
        OkHttpUtils.post().params(map).url(APIUrls.URL_SCAN_FANS_CODE).build().execute(call);
    }

    /**
     * 粉丝大礼包 含客服领取状态
     */
    public static void loadFansClothingState(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.URL_SCAN_FANS_CLOTHING_STATE).build().execute(call);
    }

    /**
     * 查询证书信息
     */
    public static void loadFansCertificate(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.URL_SCAN_FANS_CERTIFICATE).build().execute(call);
    }

    /**
     * 粉丝中心 视频配置
     */
    public static void loadFansConfig(Callback call) {
        Map<String, String> map = new HashMap<>();
        OkHttpUtils.post().params(map).url(APIUrls.URL_SCAN_FANS_CONFIG).build().execute(call);
    }

    /**
     * 兑换酣客服装
     */
    public static void loadFansExchangeClothing(String token, long id, String properties, long uaid, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        map.put("id", String.valueOf(id));
        map.put("properties", properties);
        map.put("uaid", String.valueOf(uaid));
        OkHttpUtils.post().params(map).url(APIUrls.URL_SCAN_FANS_EXCHANGE_CLOTHING).build().execute(call);
    }

    /**
     * 是否是老粉丝
     */
    public static void loadOldMember(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.URL_SCAN_FANS_OLD).build().execute(call);
    }

    /**
     * 商城首页
     */
    public static void loadMallHome(long categoryId, String nextCursor, Callback call) {
        Map<String, String> map = new HashMap<>();
        if (categoryId > 0) {
            map.put("categoryId", String.valueOf(categoryId));
        }
        map.put("cursor", nextCursor);
        OkHttpUtils.post().params(map).url(APIUrls.URL_MALL_HOME).build().execute(call);
    }

    /**
     * 商城购物车数量
     */
    public static void loadMallShopNum(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.URL_MALL_SHOP_NUM).build().execute(call);
    }

    /**
     * 首页-活动弹窗 banner
     */
    public static void reqHomePageActiveBannerPop(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.url_active_banner_pop).build().execute(call);
    }

    /**
     * 首页-粉丝弹窗 banner
     */
    public static void reqHomePageActiveFansPop(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.url_active_fans_pop).build().execute(call);
    }

    /**
     * 首页活动弹窗--是否中奖
     */
    public static void reqHomePageActiveIsWin(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.url_active_banner_is_win).build().execute(call);
    }


    /**
     * 获取未读消息
     */
    public static void reqUnReadNum(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.url_message_unreadcount).build().execute(call);
    }

    /**
     * 消息-主页-广播列表（外部）
     */
    public static void reqMessageSystemList(String token, Callback call) {
        Map<String, String> map = new HashMap<>();
        map.put("token", token);
        OkHttpUtils.post().params(map).url(APIUrls.url_message_system_list).build().execute(call);
    }

}
